
package com.jf.cloud.order.service.impl;

import com.jf.cloud.common.i18n.LanguageEnum;
import com.jf.cloud.order.mapper.PurchaseOrderLangMapper;
import com.jf.cloud.order.model.PurchaseOrderLang;
import com.jf.cloud.order.service.PurchaseOrderLangService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 采购订单-国际化
 *
 * @author zz
 * @date 2022-07-12 13:57:20
 */
@Service
public class PurchaseOrderLangServiceImpl implements PurchaseOrderLangService {

    @Autowired
    private PurchaseOrderLangMapper purchaseOrderLangMapper;

    @Override
    public void saveBatch(StringBuilder orderSpuNameCn, StringBuilder orderSpuNameEn, Long purchaseOrderId) {
        List<PurchaseOrderLang> purchaseOrderLangList = new ArrayList<>();
        PurchaseOrderLang purchaseOrderLang = new PurchaseOrderLang();
        purchaseOrderLang.setLang(LanguageEnum.LANGUAGE_ZH_CN.getLang());
        purchaseOrderLang.setSpuName(orderSpuNameCn.toString());
        purchaseOrderLang.setPurchaseOrderId(purchaseOrderId);

        PurchaseOrderLang purchaseOrderLangEn = new PurchaseOrderLang();
        purchaseOrderLangEn.setLang(LanguageEnum.LANGUAGE_EN.getLang());
        purchaseOrderLangEn.setSpuName(orderSpuNameEn.toString());
        purchaseOrderLangEn.setPurchaseOrderId(purchaseOrderId);
        purchaseOrderLangList.add(purchaseOrderLang);
        purchaseOrderLangList.add(purchaseOrderLangEn);
        purchaseOrderLangMapper.saveBatch(purchaseOrderLangList);
    }
}
